<template>
  <div
    class="standingbook-inspect"
    v-loading="$store.getters.loading"
    element-loading-text="拼命加载中"
    element-loading-spinner="el-icon-loading"
    element-loading-background="#a19f9fb0;"
  >
    <lb-layout>
      <Title name="碳排核查管理" :line="false" :noLineHeight="true"></Title>
      <!-- 按钮搜索部分 -->
      <el-row style="margin-top: 10px">
        <el-col :span="22">
          <!-- <span style="color: #ffffff">碳排核查</span> -->
          <el-form
            :model="queryParams"
            ref="queryForm"
            size="small"
            :inline="true"
          >
            <el-form-item prop="manageId">
              <el-select
                v-model="queryParams.manageId"
                placeholder="请选择"
                :clearable="false"
                @change="handleSelectmanage"
              >
                <el-option
                  v-for="item in manageOptions"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                  size="small"
                  class="input3"
                >
                </el-option>
              </el-select>
            </el-form-item>
          </el-form>
        </el-col>
        <el-col :span="2" class="back-button">
          <el-button type="primary" size="small" @click="handleSubmit">
            碳排审核
          </el-button>
          <el-button
            v-if="exportFlage"
            icon="el-icon-right"
            size="small"
            @click="handleExport"
          >
            导出
          </el-button>
          <el-button @click="goBack" size="small">返回</el-button>
        </el-col>
      </el-row>
      <!-- 表格表单部分 -->
      <el-row>
        <el-col :span="24" class="table">
          <el-form
            :model="inspectForm"
            size="small"
            ref="form"
            :label-position="labelPosition"
          >
            <!-- :rules="inspectRules" -->
            <el-row>
              <el-col :span="8" :offset="8" class="mid-title">
                <span>核查结论</span>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="8" :offset="16" class="table-date">
                <span
                  >限定提交日期：
                  {{
                    inspectForm.limitSubmissionDate == null
                      ? "无"
                      : inspectForm.limitSubmissionDate
                  }}
                </span>
                <span
                  >实际提交日期：
                  {{
                    inspectForm.actualSubmissionDate == null
                      ? "无"
                      : inspectForm.actualSubmissionDate
                  }}
                </span>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="24">
                <!-- 一、重点排放单位基本信息 -->
                <el-descriptions
                  class="descriptions descriptionsfirst"
                  :title="deTable[0].title"
                  :column="deTable[0].column"
                  :size="'mini'"
                  border
                >
                  <el-descriptions-item>
                    <template slot="label">重点排放单位名称</template>
                    <el-form-item prop="companyName">
                      <el-input
                        v-model="inspectForm.companyName"
                        size="small"
                        class="inputStyle"
                      ></el-input>
                    </el-form-item>
                  </el-descriptions-item>
                  <el-descriptions-item>
                    <template slot="label">重点排放单位地址</template>
                    <el-form-item prop="companyAddress">
                      <el-input
                        v-model="inspectForm.companyAddress"
                        size="small"
                        class="inputStyle"
                      ></el-input>
                    </el-form-item>
                  </el-descriptions-item>
                  <el-descriptions-item>
                    <template slot="label">统一社会信用代码</template>
                    <el-form-item prop="unifiedSocialCreditCode">
                      <el-input
                        v-model="inspectForm.unifiedSocialCreditCode"
                        size="small"
                        class="inputStyle"
                      ></el-input>
                    </el-form-item>
                  </el-descriptions-item>
                  <el-descriptions-item>
                    <template slot="label">法定代表人</template>
                    <el-form-item prop="legalPerson">
                      <el-input
                        v-model="inspectForm.legalPerson"
                        size="small"
                        class="inputStyle"
                      ></el-input>
                    </el-form-item>
                  </el-descriptions-item>
                </el-descriptions>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="24">
                <!-- 二、文件评审和现场核查过程 -->
                <el-descriptions
                  class="descriptions"
                  :title="deTable[1].title"
                  :column="deTable[1].column"
                  :size="'mini'"
                  border
                >
                  <el-descriptions-item>
                    <template slot="label">承担单位</template>
                    <el-form-item prop="verificationTechnicalUnit">
                      <el-input
                        v-model="inspectForm.verificationTechnicalUnit"
                        size="small"
                        class="inputStyle"
                      ></el-input>
                    </el-form-item>
                  </el-descriptions-item>
                  <el-descriptions-item>
                    <template slot="label">组成人员</template>
                    <el-form-item prop="verificationTechnician">
                      <el-input
                        v-model="inspectForm.verificationTechnician"
                        size="small"
                        class="inputStyle"
                      ></el-input>
                    </el-form-item>
                  </el-descriptions-item>
                  <el-descriptions-item :span="2">
                    <template slot="label">文件评审日期</template>
                    <el-form-item prop="documentReviewDate">
                      <el-date-picker
                        v-model="inspectForm.documentReviewDate"
                        type="date"
                        :value-format="valueFormat"
                        placeholder="选择日期"
                        size="small"
                        class="inputStyle"
                      >
                      </el-date-picker>
                    </el-form-item>
                  </el-descriptions-item>
                  <el-descriptions-item>
                    <template slot="label">现场承担单位</template>
                    <el-form-item prop="onSiteInspectionUnit">
                      <el-input
                        v-model="inspectForm.onSiteInspectionUnit"
                        size="small"
                        class="inputStyle"
                      ></el-input>
                    </el-form-item>
                  </el-descriptions-item>
                  <el-descriptions-item>
                    <template slot="label">现场组成人员</template>
                    <el-form-item prop="siteStaff">
                      <el-input
                        v-model="inspectForm.siteStaff"
                        size="small"
                        class="inputStyle"
                      ></el-input>
                    </el-form-item>
                  </el-descriptions-item>
                  <el-descriptions-item :span="2">
                    <template slot="label">现场核查日期</template>
                    <el-form-item prop="onSiteInspectionDate">
                      <el-date-picker
                        v-model="inspectForm.onSiteInspectionDate"
                        type="date"
                        :value-format="valueFormat"
                        placeholder="选择日期"
                        size="small"
                        class="inputStyle"
                      >
                      </el-date-picker>
                    </el-form-item>
                  </el-descriptions-item>
                  <el-descriptions-item>
                    <template slot="label">是否不予现场核查</template>
                    <el-form-item prop="noOnSiteInspectionSign">
                      <DictionariesSelect
                        :showType="1"
                        :datas="inspectForm.noOnSiteInspectionSign"
                        :modelBinding="'noOnSiteInspectionSign'"
                        :selectArr="dict.type.no_on_site_inspection_sign"
                        @handleSelect="handleSelect"
                      >
                        <!-- <div slot="tail"></div> -->
                      </DictionariesSelect>
                    </el-form-item>
                  </el-descriptions-item>
                  <el-descriptions-item v-if="onSiteflage">
                    <template slot="label">不予实施现场核查理由</template>
                    <el-form-item prop="onSiteInspectionReason">
                      <el-input
                        v-model="inspectForm.onSiteInspectionReason"
                        size="small"
                        class="inputStyle"
                      ></el-input>
                    </el-form-item>
                  </el-descriptions-item>
                </el-descriptions>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="24">
                <!-- 三、核查结果 -->
                <el-descriptions
                  class="descriptions"
                  :title="deTable[2].title"
                  :column="deTable[2].column"
                  :size="'mini'"
                  border
                >
                  <el-descriptions-item>
                    <template slot="label">1、重点排放单位基本情况</template>
                    <el-form-item prop="basicStatus">
                      <DictionariesSelect
                        :showType="1"
                        :radioType="1"
                        :datas="inspectForm.basicStatus"
                        :modelBinding="'basicStatus'"
                        :selectArr="dict.type.verification_status"
                        @handleSelect="handleSelect"
                      ></DictionariesSelect>
                    </el-form-item>
                  </el-descriptions-item>
                  <el-descriptions-item>
                    <template slot="label">2、核算边界</template>
                    <el-form-item prop="accountingBoundaryStatus">
                      <DictionariesSelect
                        :showType="1"
                        :radioType="1"
                        :datas="inspectForm.accountingBoundaryStatus"
                        :modelBinding="'accountingBoundaryStatus'"
                        :selectArr="dict.type.verification_status"
                        @handleSelect="handleSelect"
                      ></DictionariesSelect>
                    </el-form-item>
                  </el-descriptions-item>
                  <el-descriptions-item>
                    <template slot="label">3、核算方法</template>
                    <el-form-item prop="accountingMethodStatus">
                      <DictionariesSelect
                        :showType="1"
                        :radioType="1"
                        :datas="inspectForm.accountingMethodStatus"
                        :modelBinding="'accountingMethodStatus'"
                        :selectArr="dict.type.verification_status"
                        @handleSelect="handleSelect"
                      ></DictionariesSelect>
                    </el-form-item>
                  </el-descriptions-item>
                  <el-descriptions-item>
                    <template slot="label">4、核算数据</template>
                    <el-form-item prop="accountingDataStatus">
                      <DictionariesSelect
                        :showType="1"
                        :radioType="1"
                        :datas="inspectForm.accountingDataStatus"
                        :modelBinding="'accountingDataStatus'"
                        :selectArr="dict.type.verification_status"
                        @handleSelect="handleSelect"
                      ></DictionariesSelect>
                    </el-form-item>
                  </el-descriptions-item>
                  <el-descriptions-item>
                    <template slot="label">5、质控文件存档</template>
                    <el-form-item prop="qualityControlDocumentArchivingStatus">
                      <DictionariesSelect
                        :showType="1"
                        :radioType="1"
                        :datas="
                          inspectForm.qualityControlDocumentArchivingStatus
                        "
                        :modelBinding="'qualityControlDocumentArchivingStatus'"
                        :selectArr="dict.type.verification_status"
                        @handleSelect="handleSelect"
                      ></DictionariesSelect>
                    </el-form-item>
                  </el-descriptions-item>
                  <el-descriptions-item>
                    <template slot="label">6、质控制计划及执行</template>
                    <el-form-item prop="dataQualityControlExecutionStatus">
                      <DictionariesSelect
                        :showType="1"
                        :radioType="1"
                        :datas="inspectForm.dataQualityControlExecutionStatus"
                        :modelBinding="'dataQualityControlExecutionStatus'"
                        :selectArr="dict.type.verification_status"
                        @handleSelect="handleSelect"
                      ></DictionariesSelect>
                    </el-form-item>
                  </el-descriptions-item>
                  <el-descriptions-item>
                    <template slot="label">7、其他它内容</template>
                    <el-form-item prop="otherStatus">
                      <DictionariesSelect
                        :showType="1"
                        :radioType="1"
                        :datas="inspectForm.otherStatus"
                        :modelBinding="'otherStatus'"
                        :selectArr="dict.type.verification_status"
                        @handleSelect="handleSelect"
                      ></DictionariesSelect>
                    </el-form-item>
                  </el-descriptions-item>
                </el-descriptions>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="24">
                <!-- 四、核查确定 -->
                <el-descriptions
                  class="descriptions"
                  :title="deTable[3].title"
                  :column="deTable[3].column"
                  :size="'mini'"
                  border
                >
                </el-descriptions>
                <!-- （一）初次提交排放报告 -->
                <el-descriptions
                  class="descriptions second-descriptions"
                  :title="deTable[3].second[0].title"
                  :column="deTable[3].second[0].column"
                  :size="'mini'"
                  border
                >
                  <el-descriptions-item>
                    <template slot="label">GHG排放报告日期</template>
                    <el-form-item prop="firstlyGreenhouseGasEmissionReportDate">
                      <el-date-picker
                        v-model="
                          inspectForm.firstlyGreenhouseGasEmissionReportDate
                        "
                        type="date"
                        :value-format="valueFormat"
                        placeholder="选择日期"
                        size="small"
                        class="inputStyle"
                      >
                      </el-date-picker>
                    </el-form-item>
                  </el-descriptions-item>
                  <el-descriptions-item>
                    <template slot="label">排放量（tCO2e）</template>
                    <el-form-item prop="firstlyEmissionReport">
                      <el-input
                        v-model="inspectForm.firstlyEmissionReport"
                        size="small"
                        class="inputStyle"
                        @input="
                          (val) => {
                            replaceDigitDeal(val, 2, 'firstlyEmissionReport');
                          }
                        "
                      ></el-input>
                    </el-form-item>
                  </el-descriptions-item>
                  <el-descriptions-item>
                    <template slot="label">与配额分配相关数据</template>
                    <el-form-item prop="firstlyProductionData">
                      <el-input
                        v-model="inspectForm.firstlyProductionData"
                        size="small"
                        class="inputStyle"
                      ></el-input>
                    </el-form-item>
                  </el-descriptions-item>
                </el-descriptions>
                <!-- （二）最终提交报告 -->
                <el-descriptions
                  class="descriptions second-descriptions"
                  :title="deTable[3].second[1].title"
                  :column="deTable[3].second[1].column"
                  :size="'mini'"
                  border
                >
                  <el-descriptions-item>
                    <template slot="label">GHG排放报告日期</template>
                    <el-form-item prop="finallyGreenhouseGasEmissionReportDate">
                      <el-date-picker
                        v-model="
                          inspectForm.finallyGreenhouseGasEmissionReportDate
                        "
                        type="date"
                        :value-format="valueFormat"
                        placeholder="选择日期"
                        size="small"
                        class="inputStyle"
                      >
                      </el-date-picker>
                    </el-form-item>
                  </el-descriptions-item>
                  <el-descriptions-item>
                    <template slot="label">排放量（tCO2e）</template>
                    <el-form-item prop="finallyEmissionReport">
                      <el-input
                        v-model="inspectForm.finallyEmissionReport"
                        size="small"
                        class="inputStyle"
                        @input="
                          (val) => {
                            replaceDigitDeal(val, 2, 'finallyEmissionReport');
                          }
                        "
                      ></el-input>
                    </el-form-item>
                  </el-descriptions-item>
                  <el-descriptions-item>
                    <template slot="label">与配额分配相关数据</template>
                    <el-form-item prop="finallyProductionData">
                      <el-input
                        v-model="inspectForm.finallyProductionData"
                        size="small"
                        class="inputStyle"
                      ></el-input>
                    </el-form-item>
                  </el-descriptions-item>
                </el-descriptions>
                <!-- （三）其它需要说明的数据 -->
                <el-descriptions
                  class="descriptions second-descriptions"
                  :title="deTable[3].second[2].title"
                  :column="deTable[3].second[2].column"
                  :size="'mini'"
                  border
                >
                  <el-descriptions-item :span="2">
                    <template slot="label">
                      最终排放量是否涉及工作组的测算？
                    </template>
                    <el-form-item prop="emissionCertificationDescription">
                      <el-input
                        v-model="inspectForm.emissionCertificationDescription"
                        size="small"
                        class="inputStyle"
                      ></el-input>
                    </el-form-item>
                  </el-descriptions-item>
                  <el-descriptions-item :span="2">
                    <template slot="label">
                      最终与配额数据是否涉及工作组的测算？
                    </template>
                    <el-form-item prop="quotaRecognitionDescription">
                      <el-input
                        v-model="inspectForm.quotaRecognitionDescription"
                        size="small"
                        class="inputStyle"
                      ></el-input>
                    </el-form-item>
                  </el-descriptions-item>
                  <el-descriptions-item :span="2">
                    <template slot="label">其他说明</template>
                    <el-form-item prop="otherDescription">
                      <el-input
                        v-model="inspectForm.otherDescription"
                        type="textarea"
                        size="small"
                        class="inputStyle"
                      ></el-input>
                    </el-form-item>
                  </el-descriptions-item>
                  <el-descriptions-item :span="1">
                    <template slot="label">核查工作负责人</template>
                    <el-form-item prop="verificationTechnicalDirector">
                      <el-input
                        v-model="inspectForm.verificationTechnicalDirector"
                        size="small"
                        class="inputStyle"
                      ></el-input>
                    </el-form-item>
                  </el-descriptions-item>
                  <el-descriptions-item :span="1">
                    <template slot="label">签字日期</template>
                    <el-form-item prop="signDate">
                      <el-date-picker
                        v-model="inspectForm.signDate"
                        type="date"
                        :value-format="valueFormat"
                        placeholder="选择日期"
                        size="small"
                        class="inputStyle"
                      >
                      </el-date-picker>
                    </el-form-item>
                  </el-descriptions-item>
                </el-descriptions>
              </el-col>
            </el-row>
          </el-form>
        </el-col>
      </el-row>
      <!-- 说明部分 -->
      <el-row>
        <el-col :span="24" class="explain">
          <span>说明:</span>
          <span>
            1.《碳排放权交易管理办法（试行）》已于2020年12月25日由生态环境部部务会议审议通过，现予公布，自2021年2月1日起施行
          </span>
          <span>
            2. 第十条
            重点排放单位应当控制温室气体排放，报告碳排放数据，清缴碳排放配额，公开交易及相关活动信息，并接受生态环境主管部门的监督管理
          </span>
        </el-col>
      </el-row>
    </lb-layout>
  </div>
</template>

<script>
import inspectTitle from "@/views/work/standingbook/common/components/inspectTitle.vue";
import DictionariesSelect from "@/components/DictionariesSelect/index.vue";
import { exportExecl } from "@/utils/export-execl";
import { deepClone, replaceDigit, replaceInteger } from "@/utils/index";
import {
  gettmanageList,
  getExportpdf,
  putAddOrEdit,
  postDetail,
} from "@/api/standingbook/inspect.js";
export default {
  components: {
    inspectTitle,
    DictionariesSelect,
  },
  dicts: [
    "verification_status",
    "provincial_assessment",
    "no_on_site_inspection_sign",
    "verification_status",
  ],
  data() {
    return {
      exportFlage: false,
      deTable: [
        {
          title: "一、重点排放单位基本信息",
          column: 2,
        },
        {
          title: "二、文件评审和现场核查过程",
          column: 2,
        },
        {
          title: "三、核查结果",
          column: 1,
        },
        {
          title: "四、核查确定",
          column: 1,
          second: [
            {
              title: "（一）初次提交排放报告",
              column: 1,
            },
            {
              title: "（二）最终提交报告",
              column: 1,
            },
            {
              title: "（三）其它需要说明的数据",
              column: 2,
            },
          ],
        },
      ],
      inspectForm: {
        // 一
        companyName: "", // 单位详细名称
        companyAddress: "", // 单位地址
        unifiedSocialCreditCode: "", //统一社会信用代码
        legalPerson: "", //法定代表人
        // 二
        verificationTechnicalUnit: "", //核查技术组承担单位
        verificationTechnician: "", //核查技术工作组成人员
        documentReviewDate: "", //文件评审日期
        onSiteInspectionUnit: "", //现场核查工作组承担单位
        siteStaff: "", //现场工作组成人员
        onSiteInspectionDate: "", //现场核查日期
        noOnSiteInspectionSign: null, //是否不予实施现场核查
        onSiteInspectionReason: "", // 否的解释说明
        // 三
        basicStatus: null, //重点排放单位基本情况
        accountingBoundaryStatus: null, //核算边界
        accountingMethodStatus: null, //核算方法
        accountingDataStatus: null, //核算数据
        qualityControlDocumentArchivingStatus: null, //质量控制和文件存档
        dataQualityControlExecutionStatus: null, //数据质量控制计划及执行
        otherStatus: null, //其他内容
        // 四（一）
        firstlyGreenhouseGasEmissionReportDate: "", //温室气体排放报告日期
        firstlyEmissionReport: "", //初次提交报告中的排放量
        firstlyProductionData: "", //初次提交报告与配额分配相关的生产数据
        // 四（二）
        finallyGreenhouseGasEmissionReportDate: "", //温室气体排放报告日期
        finallyEmissionReport: "", //提交报告中的排放量
        finallyProductionData: "", //提交报告与配额分配相关的生产数据
        // 四（三）
        emissionCertificationDescription: "", //排放认定说明
        quotaRecognitionDescription: "", //配额认定说明
        otherDescription: "", // 其他需要说明的情况
        verificationTechnicalDirector: "", //核查技术工作负责人
        signDate: "", //签字日期
        // ID
        id: null,
        manageId: null,
        publicId: null,
        // time
        limitSubmissionDate: null, // 限定提交日期
        actualSubmissionDate: null, // 实际提交日期
      },
      inspectRules: {
        // energySavingTarget: [
        //   { required: true, message: "不能为空", trigger: "blur" },
        // ],
        // officeEnergyArea: [
        //   { required: true, message: "面积不能为空", trigger: "blur" },
        // ],
        // energyUserNumber: [
        //   { required: true, message: "人数不能为空", trigger: "blur" },
        // ],
        // provincialAssessment: [
        //   { required: true, message: "不能为空", trigger: "blur" },
        // ],
        // sharedEnergyArea: [
        //   { required: true, message: "面积不能为空", trigger: "blur" },
        // ],
      },
      queryParams: {
        manageId: null,
      },
      manageOptions: [],
      onSiteflage: false,
      labelPosition: "right",
      valueFormat: "yyyy-MM-dd",
    };
  },
  created() {
    if (this.$route.query.id) {
      this.getDatetime(this.$route.query.id);
    }
  },
  mounted() {},
  methods: {
    getDatetime(id) {
      let params = {
        id: id,
      };
      gettmanageList(params)
        .then((res) => {
          if (res.code === 700) {
            this.$message.warning(res.msg);
            return false;
          }
          if (res.rows.length > 0) {
            res.rows.map((item) => {
              let obj = {
                label: item.limitSubmissionDate,
                value: item.id,
              };
              this.manageOptions.push(obj);
            });
            this.defaultRequest();
          }
        })
        .catch((err) => {
          // this.$message.error("系统错误,请联系管理员!20030");
        });
    },
    defaultRequest() {
      if (this.manageOptions.length > 0) {
        this.queryParams.manageId = this.manageOptions[0].value;
        this.getDetail();
      }
    },
    handleSelectmanage() {
      this.getDetail();
    },
    getDetail() {
      setTimeout(() => {
        this.detailRequest();
      }, 700);
    },
    detailRequest() {
      this.exportFlage = false;
      let params = {
        manageId: this.queryParams.manageId,
        publicId: this.$route.query.id,
      };
      this.$store.commit("app/updateApiCount", "add");
      postDetail(params)
        .then((res) => {
          this.$store.commit("app/updateApiCount");
          if (res.code === 700) {
            this.$message.warning(res.msg);
            return false;
          }
          if (res.data) {
            // 修改
            this.detailDeal(res.data);
            this.exportFlage = true;
          } else {
            // 新增
            this.resetForm();
            this.exportFlage = false;
          }
        })
        .catch((err) => {
          this.$store.commit("app/updateApiCount");
          // this.$message.error("系统错误,请联系管理员!20053");
        });
    },
    detailDeal(data) {
      this.inspectForm = data;
      this.onSiteflageJudge();
    },
    goBack() {
      // this.$router.go(-1);
      this.$router
        .push({ path: "/work/standingbook/common", query: {} })
        .catch(() => {});
    },
    resetForm() {
      this.inspectForm = {
        // 一
        companyName: "",
        companyAddress: "",
        unifiedSocialCreditCode: "",
        legalPerson: "",
        // 二
        verificationTechnicalUnit: "",
        verificationTechnician: "",
        documentReviewDate: "",
        onSiteInspectionUnit: "",
        siteStaff: "",
        onSiteInspectionDate: "",
        noOnSiteInspectionSign: null,
        onSiteInspectionReason: "",
        // 三
        basicStatus: null,
        accountingBoundaryStatus: null,
        accountingMethodStatus: null,
        accountingDataStatus: null,
        qualityControlDocumentArchivingStatus: null,
        dataQualityControlExecutionStatus: null,
        otherStatus: null,
        // 四（一）
        firstlyGreenhouseGasEmissionReportDate: "",
        firstlyEmissionReport: "",
        firstlyProductionData: "",
        // 四（二）
        finallyGreenhouseGasEmissionReportDate: "",
        finallyEmissionReport: "",
        finallyProductionData: "",
        // 四（三）
        emissionCertificationDescription: "",
        quotaRecognitionDescription: "",
        otherDescription: "",
        verificationTechnicalDirector: "",
        signDate: "",
        // ID
        id: null,
        manageId: null,
        publicId: null,
      };
    },
    handleSelect(val, flage, type) {
      // 定义type避免watch监听时重复赋值 '0'radio默认渲染 只执行一次
      if (type === "0") {
        if (
          this.inspectForm[flage] === null ||
          this.inspectForm[flage] === ""
        ) {
          this.inspectForm[flage] = val;
          if (flage == "noOnSiteInspectionSign") {
            this.onSiteflageJudge();
          }
        }
      } else {
        this.inspectForm[flage] = val;
        if (flage == "noOnSiteInspectionSign") {
          this.onSiteflageJudge();
        }
      }
    },
    // 是否不予实施现场核查 否的时候要显示理由
    onSiteflageJudge() {
      if (this.inspectForm.noOnSiteInspectionSign == "1") {
        this.onSiteflage = false;
      } else {
        this.onSiteflage = true;
      }
    },
    // 限制输入保留小数位数
    replaceDigitDeal(val, dit, flage) {
      this.inspectForm[flage] = replaceDigit(val, dit);
    },
    // 限制输入整数
    replaceIntegerDeal(val, flage) {
      this.inspectForm[flage] = replaceInteger(val);
    },
    // 参数处理
    paramsDeal(params) {
      params = this.inspectForm;
      params.manageId = this.queryParams.manageId;
      params.publicId = this.$route.query.id;
      if (params.noOnSiteInspectionSign == "1") {
        params.onSiteInspectionReason = "";
      }
      return params;
    },
    // 核查
    handleSubmit() {
      this.$refs["form"].validate((valid) => {
        if (valid) {
          let params = this.paramsDeal({});
          putAddOrEdit(params)
            .then((res) => {
              if (res.code === 700) {
                this.$message.warning(res.msg);
                return false;
              }
              this.$message({
                type: "success",
                message: params.id == null ? "新增成功!" : "修改成功",
              });
              setTimeout(() => {
                this.getDetail();
              }, 500);
            })
            .catch((err) => {
              // this.$message.error("系统错误,请联系管理员!20052");
            });
        }
      });
    },
    // 导出
    handleExport() {
      const params = {
        // id: this.inspectForm.id,
      };
      exportExecl(
        "核查结论" + this.inspectForm.actualSubmissionDate,
        "/energy/information/export/pdf/" + this.inspectForm.id,
        params,
        this,
        ".pdf"
      );
    },
  },
};
</script>

<style lang="scss" scoped>
.standingbook-inspect {
  width: 100%;
  .inputStyle {
    width: 400px;
  }
  .back-button {
    display: flex;
    align-items: center;
    justify-content: flex-end;
  }
  .table {
    .mid-title {
      display: flex;
      align-items: center;
      justify-content: center;
      span {
        font-family: SourceHanSansSC;
        font-weight: 400;
        font-size: 28px;
        color: rgb(16, 16, 16);
        font-style: normal;
        letter-spacing: 0px;
        line-height: 40px;
        text-decoration: none;
        margin: 0;
        padding: 0;
      }
    }
    .table-date {
      display: flex;
      flex-direction: column;
      align-items: center;
    }
  }
  .explain {
    display: flex;
    flex-direction: column;
    span {
      margin: 5px 0;
      font-family: SourceHanSansSC;
      font-weight: 400;
      font-size: 16px;
      color: rgb(149, 29, 29);
      font-style: normal;
      letter-spacing: 0px;
      line-height: 24px;
      text-decoration: none;
    }
  }
}
.descriptions {
  margin-top: 20px;
  ::v-deep .el-descriptions__title {
    font-family: SourceHanSansSC;
    font-weight: 400;
    font-size: 18px;
    color: rgb(100, 16, 19);
    font-style: normal;
    letter-spacing: 0px;
    line-height: 28px;
    text-decoration: none;
  }
}
.descriptionsfirst {
  margin-top: 0;
}
.second-descriptions {
  margin-top: 0;
  margin-bottom: 10px;
  ::v-deep .el-descriptions__title {
    font-family: SourceHanSansSC;
    font-weight: 400;
    font-size: 16px;
    color: #000000;
    font-style: normal;
    letter-spacing: 0px;
    line-height: 24px;
    text-decoration: none;
  }
}
::v-deep .el-descriptions-item__content {
  .el-input {
    transform: translateY(10px);
  }
  .DictionariesSelect {
    transform: translateY(10px);
  }
  .el-textarea__inner {
    transform: translateY(10px);
  }
}
::v-deep .el-descriptions-item__label {
  width: 260px;
}
</style>
